import java.awt.*;
import java.awt.event.*;
import javax.swing.JTree;

class BrowserFrame extends Frame implements WindowListener, ItemListener {
    Browser browser;
    TextArea output;
    List classes;
    
    public BrowserFrame(Browser b) {
        setLayout(new FlowLayout());
        setSize(320,240);
        browser = b;
        output = new TextArea("123");
        classes = new List();
        //add(output);
        //add(classes);
        SmallTalkClass[] cl = browser.getClasses();
        for(SmallTalkClass c: cl)
            classes.add(c.name);
        classes.addItemListener(this);
        addWindowListener(this);
        JTree tree = new JTree();
        tree.setSize(320,240);
        tree.add("123", output);
        add(tree);
    } 

    public void windowOpened(WindowEvent e) {
    }

    public void windowIconified(WindowEvent e) {
    }

    public void windowDeiconified(WindowEvent e) {
    }

    public void windowDeactivated(WindowEvent e) {
    }

    public void windowClosing(WindowEvent e) {
        System.exit(0);
    }

    public void windowClosed(WindowEvent e) {
    }

    public void windowActivated(WindowEvent e) {
    }

    public void itemStateChanged(ItemEvent e) {

    }
}

class Browser {
    Environment environment;
    public Browser(Environment env) {
        environment = env;
        (new BrowserFrame(this)).setVisible(true);
    }
    
    public SmallTalkClass[] getClasses() {
        return environment.classes;
    }
    
    public static void main(String[] args) throws Exception {
        new Browser(new Environment("/compiler/envirfile.ini"));
    }
}
